<template>
	<view>
		<!--  -->
		<view class="">
			<view class="flex">
				<view class="ml30"></view>
				<!-- 				<u--image :showLoading="true" :src="applyUser.uavatar" width="80px" height="80px"
					@click="click"></u--image> -->
				<view class="ms10">
					<u--image :showLoading="true"
						:src="applyUser.avatar || 'https://cdn.uviewui.com/uview/album/1.jpg' " width="80px"
						height="80px" @click="click"></u--image>
				</view>
				<view class="flex-center">
					<view class="flex">
						<view class="ml30">昵称 :</view>
						<view class="">{{ applyUser.unickname }}</view>
					</view>
				</view>
			</view>
			<u-gap height="10" bgColor="#bbb"></u-gap>
			<view class="flex" style="background-color:#e7e7e7;height:40rpx;">
				<view class="ml30"></view>
				<view class="mr30">来源:</view>
				<view class="uni-text-gray ">手机号搜索</view>
			</view>
			<u-gap height="10" bgColor="#bbb"></u-gap>
			<view class="flex-cen" style="background-color:#e7e7e7;height:40rpx;">
				<view class="text-blue-1" @click="applyFriend">添加好友</view>
			</view>

		</view>
		<!--  -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				src: 'https://cdn.uviewui.com/uview/album/1.jpg',
				search: '',
				applyUser: {},
			};
		},
		methods: {
			click() {},
			async applyFriend() {
				let re = null;
				let data = {
					"userFriend": this.applyUser.userid
				};
				try {
					re = await this.$API.friendApi.addFriend(data);
					console.log(re, 're');
					uni.showToast({
						title: '添加成功'
					});
				} catch (e) {
					console.log(e);
				}
			}
		},
		onLoad(options) {
			let data = JSON.parse(decodeURIComponent(options.data));
			console.log(data, 'data');
			this.applyUser = data;
			console.log(this.applyUser, 'this.applyUser');
			/* 填写用户消息 */
		},
		onShow(options) {
	
		}
	};
</script>

<style lang="scss">
</style>